


//自定义hook

import { useRouter } from "vue-router"
import { getCurrentInstance } from "vue"

// 

export const useCommon = () => {
    const router = useRouter()

    const goback = () => {
        router.go(-1)
    }

    const gotoSearch = () => {
        router.push('/search')
    }

    const gotoWhere = (url) => {
        router.push(url)
    }

    const getUserid = () => {
        let { getLoginUserId } = getCurrentInstance().appContext.config.globalProperties;
        return getLoginUserId()

    }
    return {
        goback,
        gotoSearch,
        gotoWhere,
        getUserid
    }
}